/**
 * 规则校验
 * */
interface FormRules {
    /** @description 必填规则 */
    requireRule: (message: string, trigger?: 'blur' | 'change') => Record<string, any>
    /** @description 长度规则 */
    lengthRule: (min: number, max: number, message: string) => Record<string, any>
}

/**
 * 表单验证规则
 * */
const FormRule: FormRules = {
    requireRule(message, trigger = 'blur') {
        return { required: true, message, trigger }
    },
    lengthRule(min, max, message) {
        return {
            min, max, message, trigger: 'blur'
        }
    }
}

export default FormRule
